/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package generadorva;

import ec.util.MersenneTwisterFast;

/**
 *
 * @author USUARIO
 */
public class Ejemplo {
    
    public static void main(String[] args) {
        Gamma gamma = new Gamma(4,1.0/2.5);
        MersenneTwisterFast mersenneTwisterFast = new MersenneTwisterFast(758769);
        double sumaG = 0;
        double sumaG2 = 0;
        int n = 10000;
        double x;
        for (int i = 0; i < n; i++) {
            x= gamma.generar(mersenneTwisterFast);
            sumaG += x;
            sumaG2 += x*x;
        }
        double mediaG = sumaG / n;
        double varianzaG = (sumaG2 - n*mediaG*mediaG)/(n-1)*1d;
        
        System.out.println("media: " + mediaG);
        System.out.println("Varianza: " + varianzaG);
    }
    
}
